home *** CD-ROM | disk | FTP | other *** search
- /* $VER: CutNPaste.dopus5 2.2SE (21.10.98) */
- /* Special Version for Opus Magellan II */
-
- /* Cut & Paste module - Adds "Cut" and "Copy" to file pop-up menus */
- /* and "Paste" to lister pop-up menus. Nothing is done until you */
- /* Paste when the appropriate Copy or Move command is issued. */
- /* Andrew Dunbar Oct 1997 */
- /* <andrew@gpsoft.com.au> */
-
- /* Fixed problems with space in filenames and added locale support */
- /* and Danish catalog. */
- /* Michael Skibsted Sørensen, Oct 1998 */
- /* <MSS@kob.dk> */
-
- /* Added "Paste into" to directory pop-up menus and "Paste as.." */
- /* and "Paste into as.." commands using CopyAs or MoveAs commands. */
- /* Added "View Clipboard Contents" and "Clear Clipboard Contents" */
- /* commands + other minor changes. */
- /* Keith Halstead, Oct 1998 */
- /* <cv51kh@surrey.ac.uk> */
-
- /* MULTIPLE FILE SUPPORT WILL BE AVAILABLE NOW! - CHECK AMINET!! */
-
- parse arg portname function source dest arguments
- address value portname
- options results
-
- if ~show('l','rexxsupport.library') then
- call addlib('rexxsupport.library',0,-30,0)
- if ~show(l,'locale.library') then
- call addlib('locale.library',0,-30)
- if show(l,'locale.library') then
- catalog = opencatalog('CutNPaste.catalog','english',0)
-
- if function = 'init' then do
- cnptypes = 'type drawer type tool type project type trash'
- dopus command 'Clip-Copy' program 'CutNPaste' ext locale(1,'Copy') private cnptypes
- dopus command 'Clip-Cut' program 'CutNPaste' ext locale(2,'Cut') private cnptypes
- dopus command 'Clip-Paste' program 'CutNPaste' ext locale(3,'Paste') private type lister
- dopus command 'Clip-PasteAs' program 'CutNPaste' ext locale(4,'Paste As...') private type lister
- dopus command 'Clip-PasteInto' program 'CutNPaste' ext locale(5,'Paste Into') private type disk type drawer
- dopus command 'Clip-PasteIntoAs' program 'CutNPaste' ext locale(6,'Paste Into As...') private type disk type drawer
- dopus command 'Clip-View' program 'CutNPaste' ext locale(9,'View Clipboard Contents...') private type lister
- dopus command 'Clip-Clear' program 'CutNPaste' ext locale(10,'Clear Clipboard Contents...') private type lister
- end
-
- else if function = 'Clip-Clear' then do
- if exists('T:clipcnp')=1 then command 'delete T:clipcnp quiet'
- end
-
- else if function = 'Clip-View' then do
- if open('cnpfile','T:clipcnp','r') then do
- cnpinfo = "'"readln('cnpfile')"'"
- call close('cnpfile')
- parse var cnpinfo cmd ' ' srcfile
- srcfile = trim(srcfile)
- if srcfile ~= '' then dopus request locale(11,'Clipboard contents')||"': '"cnpinfo""
- else dopus request locale(7,'Paste: Clipboard invalid')
- end
- else dopus request locale(8,'Paste: Nothing in clipboard')
- end
-
- else if function = 'Clip-Cut' then address command 'echo >T:clipcnp cut 'arguments
-
- else if function = 'Clip-Copy' then address command 'echo >T:clipcnp copy 'arguments
-
- /* PASTE (AS) */
- if function = 'Clip-Paste' | function = 'Clip-PasteAs' then do
- lister query source path
- pastepath = result
- call mainfunc
- end
-
- /* PASTE INTO (AS) */
- if function = 'Clip-PasteInto' | function = 'Clip-PasteIntoAs' then do
- pastepath = arguments
- call mainfunc
- end
-
- exit
-
- locale:
- parse arg msgno,msgstring
-
- if catalog ~= 0 then
- msgstring = getcatalogstr(catalog,msgno,msgstring)
-
- do i = 3 to arg()
- parse var msgstring before '%s' after
- msgstring = before||arg(i)||after
- end
- return '"'msgstring'"'
-
- mainfunc:
- if open('cnpfile','T:clipcnp','r') then do
- cnpinfo = readln('cnpfile')
- call close('cnpfile')
- parse var cnpinfo cmd ' ' srcfile /* Spaces in source name/path fixed */
- srcfile = trim(srcfile) /* by Michael Skibsted Sørensen */
- if srcfile ~= '' then do
- srcfile = '"'srcfile'"'
- if function = 'Clip-Paste' | function = 'Clip-PasteInto' then do
- if cmd = 'copy' then command wait copy 'name='srcfile 'to='pastepath
- else if cmd = 'cut' then command wait move 'name='srcfile 'to='pastepath
- if function = 'Clip-Paste' then lister read source pastepath force
- end
- else if function = 'Clip-PasteAs' | function = 'Clip-PasteIntoAs' then do
- if cmd = 'copy' then command wait copyas 'name='srcfile 'to='pastepath
- else if cmd = 'cut' then command wait moveas 'name='srcfile 'to='pastepath
- if function = 'Clip-PasteAs' then lister read source pastepath force
- end
- if cmd = 'cut' then do
- srcfile=compress(srcfile,'"')
- if exists(srcfile)=0 then command 'delete T:clipcnp quiet'
- end
- end
- else dopus request locale(7,'Paste: Clipboard invalid')
- end
- else dopus request locale(8,'Paste: Nothing in clipboard')
- return
-